package com.timebank.score.controller;

import com.timebank.common.core.web.controller.BaseController;
import com.timebank.common.core.web.page.TableDataInfo;
import com.timebank.common.core.web.pojo.AjaxResult;
import com.timebank.common.security.annotation.RequiresLogin;
import com.timebank.score.pojo.entity.ScoreTrade;
import com.timebank.score.pojo.vo.ScoreTradeVO;
import com.timebank.score.service.ScoreTradeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 积分交易 控制层
 * @author shiliuyinzhen
 */
@RestController
@RequestMapping("/trade")
@Api(tags = "积分交易相关接口")
public class ScoreTradeController extends BaseController {

    @Resource
    private ScoreTradeService scoreTradeService;

    /**
     * 获取积分交易列表
     * @param scoreTrade
     * @return
     */
    @RequiresLogin
    @GetMapping("/list")
    @ApiOperation("获取积分交易列表")
    public TableDataInfo getScoreTradeList(ScoreTrade scoreTrade){
        startPage();
        List<ScoreTradeVO> list = scoreTradeService.getScoreTradeList(scoreTrade);
        return getDataTable(list);
    }
}
